package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.PrivateMessage;
import cn.wolfcode.trip.base.domain.Region;
import cn.wolfcode.trip.base.domain.SystemMessages;
import cn.wolfcode.trip.base.mapper.PrivateMessageMapper;
import cn.wolfcode.trip.base.query.PrivateMessageQueryObject;
import cn.wolfcode.trip.base.query.SystemMessagesQueryObject;
import cn.wolfcode.trip.base.service.IPrivateMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
@Service
public class PrivateMessageServiceImpl implements IPrivateMessageService {
    @Autowired
    private PrivateMessageMapper privateMessageMapper;
    @Override
    public List<Region> listMenus(Long parentId) {
        return null;
    }

    @Override
    public void saveOrUpdate(PrivateMessage entity) {
        if(entity.getId()==null){
            entity.setSendtime(new Date());
            entity.setStatus(0);
            privateMessageMapper.insert(entity);
        }
    }

    @Override
    public List<PrivateMessage> list(Integer state) {
        return null;
    }

    @Override
    public List<SystemMessages> getprivateMessage(PrivateMessageQueryObject qo) {

        return privateMessageMapper.getprivateMessage(qo);
    }
    //获取当前私信的所有信息
    @Override
    public PrivateMessage get(Long id) {
        return privateMessageMapper.selectByPrimaryKey(id);
    }

    @Override
    public void update(PrivateMessageQueryObject qo) {
        privateMessageMapper.updateByPrimaryKey(qo);
    }
}
